Now let's take a look at what happens when
a container is ready to serve requests. A container is in the serving request
state as long as it handles web requests. If it handles no request for
100 milliseconds, the container transitions
into the idle state. Speaking of idle,
that's another important state. We've covered it in a previous module,
but let's review. Understanding idle
containers is important. An idle container does not serve requests. An idle container is also free,
which means you are not charged. Idle containers on
Cloud Run are special in the sense that they have
three important limitations. Cloud Run throttles the CPU of
the idle container to nearly zero, which means that your application
will run very slowly. Network requests through third parties are
likely to fail when the container is idle. Finally, an idle container
can be shut down and you have no control
over when that happens. You do, however, have a lifecycle hook
you can use to shut down gracefully. We'll cover that later in this module. Containers can go from idle to serving and back again many times
before shutting down. During the state, transition from
idle to serving Cloud Run returns full access to the containers
CPU immediately. Your application and
your user won't notice any lag. People often wonder how long a container
stays idle before it shuts down. Some have observed really long
idle times of up to 48 hours. Others are surprised to find that
Cloud Run immediately claims an idle container after it
served the last request. The answer here is you don't know when
Cloud Run stops an idle container. Cloud Run might keep idle containers
around longer to serve traffic bursts without starting new containers. However, there are no guarantees
that this will happen. You can reserve idle containers on Cloud
Run and prevent them from shutting down. The minimum instances, setting
ensures that Cloud Run always keeps a certain amount of containers ready
to serve requests at a moments notice. Later in this module,
I'll discuss that feature in more detail.